Repository navigation
Loopback MCP tool bridge for installed ACP agents - #385
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #378.
Exposes Bate's per-bot capabilities (memory notes, isolated Chrome browser with model-blind Secrets, Apple apps, desktop helper, project Surfaces, and bot-to-bot mail) to installed ACP agents over a per-bot loopback-only MCP endpoint so bots running on installed agents are first-class citizens in Bate:
appd/src/mcp_bridge.rs):127.0.0.1:<ephemeral-port>with a fresh random 32-byte per-session bearer token verified in constant time (fixed-length SHA-256 digest XOR comparison), never logged and never persisted.initialize,notifications/initialized,ping,tools/list,tools/call) on background threads offCore::run.appd/src/core.rs,appd/src/limit.rs):BridgeHandleautomatically wheneverstart_enginelaunches an installed ACP agent (agent.is_some()), adds its ephemeral port to the bot's SeatbeltBRIDGEallow rule if network-limited, and injects the syntheticbateHTTP MCP server intoOp::Connectorswithout mutating any global agent configuration files.Coreenforcement (appd/src/core.rs):tools/callruns throughCore's pause check,token_stoplimit check,decide_alonepermission check,Needs youapproval cards (Approve,Deny,Always,Conversation, still always asking for Apple app sends/changes), andtool_start/tool_endtranscript audit trail.mcpBridgecards withAllow once/Deny.Evidence
cd window/ui && npm ci && npm run build && npm test: 142/142 passed.cargo fmt --all --check: clean.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo test --workspace --locked: all crates passed, including:appdunit test:mcp_bridge::tests::enforces_bearer_token_serves_mcp_and_shuts_down_on_drop.appd --test service:loopback_mcp_bridge_authenticates_enforces_approvals_and_shuts_downverifying automatic ACP connector injection, token secrecy (never in logs orlist_connectors), 401 on missing/wrong tokens,Needs youapproval card +Approve/Denyenforcement,neverpermission refusal, pause refusal, transcript audit trail, and port shutdown ondelete_bot.Merge Danger
Low. The loopback bridge only starts for bots configured with an installed ACP agent, binds exclusively to
127.0.0.1, requires a per-session bearer token, and routes all actions through Bate's existing permission and audit code paths.Device decision
answerover LAN continues to follow its documented rules (Approve,Deny,Always,Conversation, respectingalways_asks).127.0.0.1and is never exposed over LAN or Tailscale. Documented inPROTOCOL.md.